Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#4700) - fix and test Webpack #4701

Closed
wants to merge 1 commit into from
Closed

(#4700) - fix and test Webpack #4701

wants to merge 1 commit into from

Conversation

nolanlawson
Copy link
Member

This fixes Webpack support, and additionally it tests Webpack in CI.

There were (surprisingly) quite a few changes that needed to be made to support this:

  • require('request') needed to be isolated to its own file and then swapped with the -browser version at that level
  • browserify-versionify wasn't working at all with Webpack and was breaking the tests, since Webpack just left the '__VERSION__' string in there as-is. So I swapped it out for a new Browserify transform that I wrote - package-json-versionify, which simply removes everything from package.json except for "version". Webpack will ignore this transform, meaning that Webpack users are punished with a larger bundle size, but it still works.
  • Unfortunately, once you start doing require('../package.json'), Webpack loses its mind and you suddenly need a json-loader. AFAICT from this discussion, this is expected behavior and they intend for end-users to include custom loaders to deal with this stuff. So unfortunately our users are going to have to do that. Hopefully they've run into it enough times before that it won't surprise them. (WTF, why can't you just require() a JSON file without any additional configuration?)

I think moving forward it is super important that we test Webpack in CI, because I cannot believe how much bending over backwards you have to do to support it and Browserify simultaneously.

"./lib/deps/env/isChromeApp.js": "./lib/deps/env/isChromeApp-browser.js",
"./lib/deps/ajax/explainError.js": "./lib/deps/ajax/explainError-browser.js",
"./lib/deps/ajax/prequest.js": "./lib/deps/ajax/prequest-browser.js",
"./lib/deps/ajax/request.js": "./lib/deps/ajax/request-browser.js",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sorted these alphabetically; the only true change is the above line.

@daleharvey
Copy link
Member

👍 this is awesome, thanks, merry christmas :)

@daleharvey
Copy link
Member

Merged in e586068

@daleharvey daleharvey closed this Dec 26, 2015
@nolanlawson
Copy link
Member Author

Heh, Merry Christmas to you too. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants